/**
 * Created by tdzl2003 on 12/18/16.
 */

import React, {Component} from "react";
import {NativeModules, StyleSheet, View} from "react-native";
import {NavigationActions} from "react-navigation";
import AppService from "../service/AppService";
import MySuggestList from "./MySuggestList";
import CoordinationList from "./CoordinationList";

const styles = StyleSheet.create({});


export default class Home extends Component {

    constructor(props) {
        super(props);
    }

    // componentWillMount() {
    //     NativeModules.security.getPassportId().then((result) => {
    //             global.passportId = result;
    //             AppService.getPassport({id: result}).then(data => {
    //                 global.tenantId = data.passport.tenantId;
    //                 global.userId = data.passport.userId;
    //                 if (global.isHome) {
    //                     AppService.findSysProduct({code: "com.xiniunet.xntalk"}).then(data => {
    //                         if (data.result && data.result[0] && data.result[0].id) {
    //                             let productId = data.result[0].id;
    //                             AppService.getAuthList({productId: productId}).then(data => {
    //                                 if (data.result && data.result.length > 0) {
    //                                     global.isCoordinator = false;
    //                                     for (let i = 0; i < data.result.length; i++) {
    //                                         if ("suggest.mobile.coordinator" == data.result[i]) {
    //                                             global.isCoordinator = true;
    //                                             break;
    //                                         }
    //                                     }
    //                                     if (global.isCoordinator) {
    //                                         this.goPage('CoordinationList');
    //                                     } else {
    //                                         this.goPage('MySuggestList');
    //                                     }
    //                                 } else {
    //                                     this.goPage('MySuggestList');
    //                                 }
    //                             });
    //                         } else {
    //                             this.goPage('MySuggestList');
    //                         }
    //                     });
    //                 }
    //             });
    //         }
    //     ).catch((error) => {
    //         console.log(error)
    //     });
    // }
    //
    // goPage = (name) => {
    //     const{navigator} = this.props;
    //     if (name == "MySuggestList") {
    //         navigator.push({name: "MySuggestList", component: MySuggestList});
    //     } else {
    //         navigator.push({name: "CoordinationList", component: CoordinationList});
    //     }
    // };

    render() {
        return <View></View>;
    }
}
